<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html>
<head>
<base href="<%=basePath%>">
<meta charset="UTF-8">
<title>bbs.jsp</title>
<script>
	$(function() {
		$.ajax({
			url : "sort/getSort",
			data : {},
			dataType : "json",
			type : "get",
			success : function(res) {
				//console.log(res);
				var select = $("select");
				$(res).each(
						function() {
							var op = "<option value='"+this.id+"'>" + this.name
									+ "</option>";
							select.append(op);
						});
			},
			error : function(res) {
				console.log(res)
			}
		});
	})
</script>
</head>
<body>
	<div class="box">
		<span>讨论版区</span>
		<form method="get" action="bbs/bbsList">
			<select name="sort">
				<option value="0">全部</option>
			</select>
		</form>
		<button>发帖</button>
		<table align="center" border="1" class="providerTable" cellpadding="0"
			cellspacing="0" style="text-align: center">
			<tr class="fir">
				<th width="5%">帖子ID</th>
				<th width="40%">标题</th>
				<th width="10%">作者</th>
				<th width="22%">发布时间</th>
				<th width="22%">回复次数</th>
			</tr>
			<c:forEach items="${LIST }" var="bbs">
				<tr>
					<td>${bbs.id }</td>
					<td>${bbs.title}</td>
					<td>${bbs.author}</td>
					<td>${bbs.createDate}</td>
					<td>${bbs.replyCount}</td>
				</tr>
			</c:forEach>
		</table>
	</div>
</body>
</html>